package com.pms.utils;

public class PageUtil {
    public static DataTableRequest checkRequestData(DataTableRequest data){
        if (data.getLength() == 0){
            data.setLength(10);
        }
        if (data.getStart() == 0){
            data.setStart(1);
        }
        return data;
    }
    public static int getPageNum(DataTableRequest data){
        int page = 1;
        if(data.getStart() >= data.getLength()){
            page = data.getStart()/data.getLength() + 1;
        }else {
            page = data.getStart()/data.getLength();
        }
        return page;
    }
}
